﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(menuName = "AssetsManager/AssetsCatalog")]
public class AssetsCatalog : ScriptableObject
{
    [SerializeField] private AssetItem[] assetItems;

    /// <summary>
    /// 使用assetKey获取资源配置
    /// </summary>
    /// <param name="assetKey">资源的Key</param>
    /// <returns></returns>
    public AssetItem GetAssetItemByKey(string assetKey)
    {
        for (int i = 0; i < assetItems.Length; i++)
        {
            if (assetItems[i].assetKey == assetKey)
                return assetItems[i];
        }
        Debug.LogError($"assetItem with key:{assetKey} not exist");
        return null;
    }
}

[System.Serializable]
public class AssetItem
{
    public string assetKey;
    public string assetPath;
}
